<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
	<script type="text/javascript">
		$(function() {
			var treeData = [ {
				text : "用户管理",
				children : [ {
					text : "用户管理",
					attributes : {
						url : "subpage/userManage.jsp"
					}
				} ]
			}, {
				text : "二手管理",
				children : [ {
					text : "二手商品管理",
					attributes : {
						url : "subpage/goodsManage.jsp"
					}
				}, {
					text : "商品留言管理",
					attributes : {
						url : "subpage/messageManage.jsp"
					}
				} ]
			}, {
				text : "失物招领",
				children : [ {
					text : "失物招领管理",
					attributes : {
						url : "subpage/lostManage.jsp"
					}
				} ]
			}, {
				text : "新闻资讯",
				children : [ {
					text : "新闻资讯管理",
					attributes : {
						url : "subpage/newsManage.jsp"
					}
				} ]
			}, {
				text : "校车时刻",
				children : [ {
					text : "校车时刻管理",
					attributes : {
						url : "subpage/carManage.jsp"
					}
				} ]
			}, {
				text : "管理员",
				children : [ {
					text : "管理员信息管理",
					attributes : {
						url : "subpage/adminManage.jsp"
					}
				} ]
			}, {
				text : "工具箱",
				children : [ {
					text : "网站导航",
					attributes : {
						url : "http://hao.uc.cn/"
					//url : "http://site.baidu.com"
					}
				}, {
					text : "保存设置",
					attributes : {
						//url : "systemAction/refreshSystem.do",
						action : 1
					}
				} ]
			} ];

			$("#tree").tree({
				data : treeData,
				lines : true,
				onClick : function(node) {
					if (node.attributes.url) {
						openTab(node.text, node.attributes.url);
					}
					if (node.attributes.action) {
						refreshSystem();
					}
				}
			})

			function openTab(text, url) {
				if ($("#tabs").tabs('exists', text)) {
					$("#tabs").tabs('select', text);
				} else {
					var content = "<iframe frameborder='0' scrolling='auto' style='width:100%;height:99%;' src=" + url
							+ "></iframe>";
					$("#tabs").tabs('add', {
						title : text,
						closable : true,
						content : content
					});
				}
			}
			$('#c_calendar').calendar({
				fit : false,
				width : 194,
				height : 180,
				current : new Date()
			});
		});
		function refreshSystem() {
			$.post("systemAction/refreshSystem.do", {}, function(result) {
				if (result.success) {
					$.messager.alert("系统提示", "已成功刷新系统缓存！");
				} else {
					$.messager.alert("系统提示", "刷新系统缓存失败！");
				}
			}, "json");
		}
	</script>
	<ul id="tree" class="easyui-tree"></ul>
	<div id="c_calendar" style="position: absolute; left: 0px; bottom: 0px;"></div>
</body>
</html>